package com.heima.wemedia.config;


import lombok.Data;
import net.sourceforge.tess4j.Tesseract;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "heima.tess4j")
public class Tess4jConfig {

    private String dataPath;
    private String language;

    @Bean
    public Tesseract tesseract() {
        //创建Tesseract对象
        Tesseract tesseract = new Tesseract();
        //设置字体库路径
        tesseract.setDatapath(dataPath);
        //中文识别
        tesseract.setLanguage(language);
        return tesseract;
    }
}